package servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author admin
 * @Date 2019/2/27 13:36
 */
@WebServlet(name = "DeleteServlet",urlPatterns = "/delete")
public class DeleteServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
       //从请求中获取参数
       String id = request.getParameter("id");

        int pid = Integer.parseInt(id);
       // ....

        //重定向（两次）？转发（一次）？？
        //重定向:查询全部
        //获得项目名path
        String path = request.getContextPath();
        response.sendRedirect(path+"/findAll");


    }
}
